package com.wsjzzcbq.qianyuan.common.bean;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import java.time.LocalDateTime;

/**
 * 基础实体类
 */
@Data
public class BasicBean {

    @TableId
    protected Long id;

    protected String createBy;

    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    protected LocalDateTime createDate;

    protected String updateBy;

    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.UPDATE)
    protected LocalDateTime updateDate;

    protected String remark;

    @TableLogic(value = "0", delval = "1")
    protected Integer delFlag;

    /**
     * ID_WORKER 生成主键太长导致 js 精度丢失
     * @return
     */
    @JsonSerialize(using= ToStringSerializer.class)
    public Long getId() {
        return id;
    }
}
